<?php
/**
 * Dizkus
 *
 * @copyright (c) 2001-now, Dizkus Development Team
 * @link http://www.dizkus.com
 * @version $Id: pnaccountapi.php,v 1.1 2010/08/26 10:45:24 parinya Exp $
 * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
 * @package Dizkus
 */

/**
 * Return an array of items to show in the your account panel
 *
 * @params   uname   string   the user name
 * @return   array   array of items, or false on failure
 */
function InnoForum_accountapi_getall($args)
{
    // the array that will hold the options
    $items = null;

    // show link for users only
    if(!pnUserLoggedIn()) {
        // not logged in
        return $items;
    }

    $uname = (isset($args['uname'])) ? $args['uname'] : pnUserGetVar('uname');
	$user_id = SessionUtil::getVar('uid');
    // does this user exist?
    if(pnUserGetIDFromName($uname)==false) {
        // user does not exist
        return $items;
    }

    // Create an array of links to return
    if(SecurityUtil::checkPermission('InnoForum::', '::', ACCESS_OVERVIEW)) {
        pnModLangLoad('InnoForum', 'user'); 
        $items = array(array('url'     => "index.php?module=InnoForum&func=list&ctrl=my_topics&user_id=$user_id",
                         	 'module' => 'core',
                             'set'     => 'icons/large',
                             'title'   => _INNOFORUM_USER_STD_HEADER_MyTopic,
                             'icon'    => 'Documents-icon-128.png'),
					   array('url'     => "index.php?module=InnoForum&func=list&ctrl=my_topics&user_id=$user_id&type_id=3",
                         	 'module' => 'core',
                             'set'     => 'icons/large',
                             'title'   => _INNOFORUM_USER_STD_HEADER_MySellTopic,
                         	 'module' => 'core',
                             'icon'    => 'Drop-Box-icon-128.png'),
					   array('url'     => "index.php?module=InnoForum&func=form&ctrl=topics",
                         	 'module' => 'core',
                             'set'     => 'icons/large',
                             'title'   => _INNOFORUM_USER_STD_HEADER_NewTopic,
                             'icon'    => 'Generic-icon-128.png'),
					   array('url'     =>"index.php?module=InnoForum&func=list&ctrl=favourite",
                         	 'module' => 'core',
                             'set'     => 'icons/large',
                             'title'   => _INNOFORUM_USER_STD_HEADER_MyFavourite,
                             'icon'    => 'Favs-icon-128.png'));
    }


    // Return the items
    return $items;
}
